home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Treccani Italiana Di Scienze Lettere Ed Arti
/
[Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso
/
pc
/
data
/
xxi_appendice_dvd.swf
/
scripts
/
__Packages
/
CAppendiceLemma.as
< prev
next >
Wrap
Text File
|
2007-11-08
|
7KB
|
220 lines
class CAppendiceLemma extends Object
{
function CAppendiceLemma(inBaseUrl, inProspBaseUrl)
{
super();
this.mBaseUrl = inBaseUrl;
this.mFrom = "";
this.mProspettiveBaseUrl = inProspBaseUrl;
this.Reset();
}
function NewLemma(id, tipo, titolo)
{
this.Reset();
this.mId = id;
this.mTipo = tipo;
this.mTitolo = StringUtils.HtmlFunction(titolo);
this.mChapterList = new Array();
}
function GetChapterLenght()
{
return this.mChapterList.length;
}
function HaveAbstract()
{
return this.mAbstract.length > 2;
}
function InitFromResult(inLemmaResult)
{
this.mInitialized = true;
if(inLemmaResult.id != this.mId)
{
}
this.mId = inLemmaResult.id;
this.mParagraphList = new Array();
this.mChapterList = new Array();
this.mMediaList = new Array();
this.mTitolo = StringUtils.HtmlFunction(inLemmaResult.titolo);
this.mParCount = inLemmaResult.parCount;
this.mAbstract = StringUtils.trimWhiteAndCr(inLemmaResult.abstract);
this.mAbstract = StringUtils.HtmlFunction(this.mAbstract);
var _loc5_ = undefined;
var _loc4_ = 0;
while(_loc4_ < inLemmaResult.indice.length)
{
var _loc10_ = inLemmaResult.indice[_loc4_];
var _loc3_ = new CAppendiceParagrafo(_loc10_);
if(_loc3_.mLevel == 0 && _loc3_.HaveText() || _loc3_.mLevel == 1)
{
_loc5_ = new Array();
this.mChapterList.push(_loc5_);
}
if(_loc5_)
{
_loc5_.push(_loc3_);
}
this.mParagraphList.push(_loc3_);
_loc4_ = _loc4_ + 1;
}
_loc4_ = 0;
while(_loc4_ < inLemmaResult.prospettive.length)
{
var _loc8_ = inLemmaResult.prospettive[_loc4_];
var _loc7_ = new CAppendiceProspettiva(this.mProspettiveBaseUrl);
_loc7_.InitFromResult(_loc8_);
this.mMediaList.push(_loc7_);
_loc4_ = _loc4_ + 1;
}
_loc4_ = 0;
while(_loc4_ < inLemmaResult.media.length)
{
var _loc9_ = inLemmaResult.media[_loc4_];
var _loc6_ = new CAppendiceContributo(this.mBaseUrl);
_loc6_.InitFromResult(_loc9_);
this.mMediaList.push(_loc6_);
_loc4_ = _loc4_ + 1;
}
}
function GetParagraph(inParNumber)
{
if(inParNumber >= 0 && inParNumber < this.mParagraphList.length)
{
return this.mParagraphList[inParNumber];
}
}
function GetParagraphById(inId)
{
var _loc3_ = null;
var _loc2_ = 0;
while(_loc2_ < this.mParagraphList.length)
{
if(this.mParagraphList[_loc2_].mId == inId)
{
_loc3_ = this.mParagraphList[_loc2_];
break;
}
_loc2_ = _loc2_ + 1;
}
return _loc3_;
}
function HaveIntroduction()
{
var _loc2_ = this.mChapterList[0];
var _loc3_ = _loc2_[0];
return _loc3_.mLevel == 0;
}
function GetChapterTitle(inChapterNum)
{
var _loc2_ = "";
var _loc4_ = this.mChapterList[inChapterNum];
var _loc3_ = _loc4_[0];
if(_loc3_.mLevel == 0)
{
_loc2_ = "";
}
else
{
_loc2_ = "<span class=\'s_title1\'>" + StringUtils.HtmlFunction(_loc3_.mTitolo) + "</span>";
}
return _loc2_;
}
function GetParagraphChapterNumber(inParId)
{
var _loc3_ = 0;
while(_loc3_ < this.mChapterList.length)
{
var _loc2_ = 0;
while(_loc2_ < this.mChapterList[_loc3_].length)
{
if(this.mChapterList[_loc3_][_loc2_].mId == inParId)
{
return _loc3_;
}
_loc2_ = _loc2_ + 1;
}
_loc3_ = _loc3_ + 1;
}
return 0;
}
function GetChapterText(inChapterNum)
{
var _loc7_ = this.mChapterList[inChapterNum];
var _loc8_ = _loc7_[0];
var _loc4_ = "<span class=\'s_content\'>";
if(_loc8_.mText.length > 0)
{
_loc4_ += "<span class=\'s_text0\'>" + StringUtils.HtmlFunction(_loc8_.mText) + "</span><br><br>";
}
var _loc3_ = 1;
while(_loc3_ < _loc7_.length)
{
var _loc2_ = _loc7_[_loc3_];
var _loc6_ = "<span class=\'s_title" + String(_loc2_.mLevel) + "\'>";
var _loc5_ = "<span class=\'s_text" + String(_loc2_.mLevel) + "\'>";
_loc4_ += _loc6_ + StringUtils.HtmlFunction(_loc2_.mTitolo) + "</span><br>";
_loc4_ += _loc5_ + StringUtils.HtmlFunction(_loc2_.mText) + "</span><br><br>";
_loc3_ = _loc3_ + 1;
}
_loc4_ += "</span>";
if(this.mId == 510 || this.mId == 285)
{
var _loc9_ = String.fromCharCode(9988);
if(_loc4_.indexOf(_loc9_) >= 0)
{
var _loc11_ = this.mId != 285 ? "A" : "B";
var _loc10_ = "<span class=\'s_Forbici\'>" + _loc11_ + "</span>";
_loc4_ = _loc4_.split(_loc9_).join(_loc10_);
}
}
return _loc4_;
}
function GetAbstractText()
{
var _loc2_ = "<span class=\'s_abstract\'>" + this.mAbstract + "</span>";
return _loc2_;
}
function GetAbstractTitle()
{
return "<span class=\'s_title1\'>Abstract</span>";
}
function GetIndiceTitle()
{
return "<span class=\'s_title1\'>Indice</span>";
}
function GetTitolo()
{
return "<span class=\'s_title0\'>" + this.mTitolo + "</span>";
}
function GetPreview()
{
var _loc2_ = "<span class=\'s_preview\'>";
_loc2_ += "<span class=\'s_title0\'>" + this.mTitolo + "</span><br><br>";
if(this.HaveAbstract())
{
_loc2_ += this.GetAbstractText();
}
else
{
var _loc3_ = this.GetChapterTitle(0);
var _loc4_ = this.GetChapterText(0);
if(_loc3_ != "")
{
_loc2_ += _loc3_ + "<br><br>";
}
_loc2_ += _loc4_;
}
_loc2_ += "</span>";
return _loc2_;
}
function Reset()
{
this.mId = "";
this.mParagraphList = new Array();
this.mMediaList = new Array();
this.mTitolo = "";
this.mParCount = 0;
this.mAbstract = "";
this.mInitialized = false;
}
}